@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                品牌管理
                <small>这是品牌管理页</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 品牌管理</a></li>
                {{--<li><a href="#"></a></li>--}}
                <li class="active">品牌添加</li>
            </ol>


        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">品牌添加</h3>
                            <!-- 用户添加失败提示信息 -->
                            @if (session('error'))
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
                                            <li>{{ session('error') }}</li>
                                </div>
                            @endif
                            <!-- 用户名已存在提示框 -->
                             @if (session('oldusername'))
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
                                            <li>{{ session('oldusername') }}</li>
                                </div>
                            @endif
                            <!-- 错误提示框 -->
                            @if (count($errors) > 0)
                                <div class="alert alert-danger alert-dismissable">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
                                    <ol>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ol>
                                </div>
                            @endif
                            <!-- 错误提示框结束 -->

                        </div><!-- /.box-header -->
                        <!-- 用户添加表单 start -->
                        <form role="form" action="/admin/brand/update" method="post" enctype="multipart/form-data">
                            <!-- 隐藏域 -->
                            {{ csrf_field() }}
                            <input type="hidden" name="oldpic" value="{{$data[0] -> brandlogo}}">
                            <input type="hidden" name="id" value="{{$data[0] -> id}}">
                            <div class="box-body">
                                <!-- 品牌类别 -->
                                <div class="form-group">
                                    <label for="exampleInputEmail1">品牌类别:&nbsp;</label>
                                    <label>
                                        @foreach($pid as $v)
                                            {{$v -> catename}}<input type="radio" name="cate_id" class="flat-red"
                                                                     @if(($data[0] -> cate_id) == ($v -> id))
                                                                             checked
                                                                     @endif
                                                                     value="{{$v -> id}}">&nbsp;
                                        @endforeach
                                    </label>

                                </div>
                                <!--品牌名  -->
                                <div class="form-group">

                                    <label for="exampleInputPassword1">品牌名</label>
                                    <input type="text" name="brandname" class="form-control" value="{{$data[0] -> brandname}}" id="exampleInputPassword1"
                                           placeholder="请输入品牌名称">
                                </div>
                                <!-- 品牌LOGO -->
                                <div class="form-group">
                                    <label for="exampleInputFile">品牌LOGO</label>
                                    <input type="file" name="brandlogo" id="exampleInputFile">
                                    <img src="{{$data[0] -> brandlogo}}" height="30" width="90">

                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">品牌类别:&nbsp;</label>
                                    <label>状态:
                                            显示:<input type="radio" name="status" class="flat-red"
                                                      @if(($data[0] -> status) == 0)
                                                              checked
                                                      @endif
                                                      value="0">&nbsp;
                                        不显示:<input type="radio" name="status" class="flat-red"
                                                   @if(($data[0] -> status) == 1)
                                                   checked
                                                   @endif
                                                   value="1">&nbsp;
                                    </label>
                                </div>
                            </div><!-- /.box-body -->
                            <div class="box-footer">
                                <!-- 提交按钮 -->
                                <button type="submit" class="btn btn-primary">编辑</button>
                                <!-- 重置按钮 -->
                                <button type="reset" class="btn btn-danger">重置</button>
                            </div>
                        </form>
                    </div><!-- /.box -->
                    <!-- 用户添加表单 end -->
                </div><!--/.col (left) -->
                <!-- right column -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection
